package com.topisv.tms.entity.interfacetask;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.topisv.tms.entity.IdEntity;

/**
 * 接口任务表
 * <p>用于反馈至第三方时记录对应的任务</p>
 * <p>有定时job读取该任务，进行反馈</p>
 * 
 * @author <a href="mailto:yuanlianghe@nryuncang.com">yuanlianghe</a>
 * @version 0.0.10
 */
@Entity
@Table(name="interface_task")
public class InterfaceTask extends IdEntity {
    private static final long serialVersionUID = -1857001286510204948L;

    /** 任务类型 
     * {@link InterfaceTaskEnum}
     */
    private String type;
    
    /** 相关单号，如订单号 */
    private String relatedNo;
    
    /** 相关数据ID， 如订单ID */
    private Long relatedId = 0L;
    
    /** 任务创建时间 */
    private Date createdTime;
    
    /** 任务更新时间，一般指最后一次发送接口成功的时间 */
    private Date updatedTime;
    
    /** 接口发送尝试次数 */
    private int retryTimes = 0;
    
    /**
     * 接口任务状态, 默认： {@value}
     * <p><code>READY</code> 表示创建完任务
     * <p><code>FINISH</code> 表示接口已成功处理
     * <p><code>ERROR</code> 表示接口处理失败
     * {@link InterfaceTaskEnum}
     */
    private String status = "READY";

    /**
     * 错误归属方，默认：{@value}
     * <p><code>-</code> 表示无
     * <p><code>SELF</code> 表示内部系统错误
     * <p><code>THIRD</code> 表示第三方系统错误
     * {@link InterfaceTaskEnum}
     */
    private String errorWho = "-";
    
    /** 错误消息 */
    private String errorMsg = "-";
    
    /** 节点，默认：{@value} */
    private String node = "-";

    public String getRelatedNo() {
        return relatedNo;
    }

    public void setRelatedNo(String relatedNo) {
        this.relatedNo = relatedNo;
    }

    public Long getRelatedId() {
        return relatedId;
    }

    public void setRelatedId(Long relatedId) {
        this.relatedId = relatedId;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(Date updatedTime) {
        this.updatedTime = updatedTime;
    }

    public int getRetryTimes() {
        return retryTimes;
    }

    public void setRetryTimes(int retryTimes) {
        this.retryTimes = retryTimes;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getErrorWho() {
        return errorWho;
    }

    public void setErrorWho(String errorWho) {
        this.errorWho = errorWho;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getNode() {
        return node;
    }

    public void setNode(String node) {
        this.node = node;
    }

}
